package com.zygh.policeasset.mapper;

import com.zygh.policeasset.pojo.PurchaseCodeGenerated;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

@Mapper
/* loaded from: police-asset-2.0-0.0.1-SNAPSHOT.jar:BOOT-INF/classes/com/zygh/policeasset/mapper/PurchaseCodeGeneratedMapper.class */
public interface PurchaseCodeGeneratedMapper {
    @Insert({"insert into purchase_code_generated(build_num,create_time,company_id,build_name) values(#{buildNum},#{createTime},#{companyId},#{buildName})"})
    Integer add(PurchaseCodeGenerated purchaseCodeGenerated);

    @Delete({"delete from purchase_code_generated where id = #{id}"})
    Integer deleteById(Integer num);

    @Select({"<script>select pcg.*,c.company_name as companyName from purchase_code_generated pcg left join company c on pcg.company_id = c.id <where><if test='buildName != null and buildName.length &gt; 0'>pcg.build_name=#{buildName} </if><if test='companyId != null'>pcg.company_id =#{companyId} </if></where></script>"})
    @Results({@Result(property = "buildNum", column = "build_num"), @Result(property = "buildName", column = "build_name"), @Result(property = "createTime", column = "create_time")})
    List<PurchaseCodeGenerated> selectList(@Param("buildName") String str, @Param("companyId") Integer num);

    @Select({"select count(*) from purchase_code_generated  where build_num = #{buildNum}"})
    Integer selectCountByBuildNum(@Param("buildNum") String str);

    @Select({"SELECT count(*)  FROM `purchase_code_info` pci LEFT JOIN `purchase_code_generated` pcg ON pcg.id = pci.purchase_code_generated_id WHERE pcg.build_num  = #{buildNum}"})
    Integer selectCountByImportBuildNum(@Param("buildNum") String str);

    @Select({"SELECT count(*)  FROM `purchase_code_info` pci LEFT JOIN `purchase_code_generated` pcg ON pcg.id = pci.purchase_code_generated_id WHERE pcg.build_num  = #{buildNum} and qr_code = #{qrCode}"})
    Integer selectCountByBuildNumAndQrCode(@Param("buildNum") String str, @Param("qrCode") String str2);
}